$: << (File.expand_path(File.dirname(__FILE__)+'/../../'))
require 'rubygems'
require 'cmdparse'
require 'gookup/gmail/gmail'
require 'gookup/reader/reader'
require 'gookup/blogger/blogger2'
require 'gookup/cmd/command_template'
$customout=false
$notinter = false

cmd = CmdParse::CommandParser.new(true,true)
cmd.program_name = "gookup"
cmd.program_version = [0, 0, 5]
cmd.add_command( CmdParse::HelpCommand.new )
cmd.add_command( CmdParse::VersionCommand.new )
reader=CommandTemplate.new('reader',"This command will backup your google reader account.","Backup your reader account subscriptions.")
gmail=CommandTemplate.new('gmail',"This command will backup your google gmail account.","Backup emails from your gmail account.")
blogger=CommandTemplate.new('blogger',"This command will backup a specefied blog name into an output folder.","Backup your blogs from your blogger account")

def reader.execute(args)
  basic_flow(args,Reader.new,:fetch_data)
end

def gmail.execute(args)
  basic_flow(args,Gmail.new,:fetch_inbox_data)
end

def blogger.execute(args)
  basic_flow(args,Blogger2.new,:fetch_all_entries)
end

[reader,gmail,blogger].each{|service| cmd.add_command(service)}
cmd.parse